JAVAC        := javac

ROOT_DIR    := .
JARS_HOME   := $(ROOT_DIR)/jars
SOURCE_DIR  := $(ROOT_DIR)/src
CLASS_DIR   := $(ROOT_DIR)/bin
OUTPUT_DIR  := $(CLASS_DIR)

BOSS_JAR    := $(JARS_HOME)/boss.jar
UNIT_JAR    := $(JARS_HOME)/junit.jar
JSON_JAR    := $(JARS_HOME)/org.json.jar

class_path  := $(BOSS_JAR):$(JSON_JAR):$(UNIT_JAR)
              
JFLAGS = -classpath $(class_path) -d $(OUTPUT_DIR)

all_javas := $(OUTPUT_DIR)/all.javas

# compile - Compile the source
.PHONY: compile

compile: $(all_javas)
	$(JAVAC) $(JFLAGS) @$<

# all_javas - Gather source file list
.INTERMEDIATE: $(all_javas)

$(all_javas):
	echo $(class_path)
	find $(SOURCE_DIR) -name '*.java' > $@

#SUBDIRS = $(SOURCE_DIR)/engine $(SOURCE_DIR)/launcher $(SOURCE_DIR)/queries $(SOURCE_DIR)/util 

clean:
	rm -r $(OUTPUT_DIR)/*


